package com.android.mvp.ui;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.widget.FrameLayout;

import com.android.mvp.R;
import com.android.mvp.base.BaseActivity;
import com.android.mvp.base.DemoFragment;
import com.android.mvp.bean.HomeBanner;
import com.android.mvp.http.ConstantValues;
import com.android.mvp.presenter.HomePresenter;
import com.android.mvp.presenter.contract.HomeContract;
import com.android.mvp.util.MyOkhttpUtils;

import java.util.List;

import butterknife.Bind;


public class MainActivity extends BaseActivity<HomePresenter, List<HomeBanner>> implements HomeContract.View {



    @Bind(R.id.my_fragment)
    FrameLayout myFragment;

    private FragmentManager mFragmentManager;
    private FragmentTransaction mFragmentTransaction;

    @Override
    public int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initToolbar() {

    }

    @Override
    protected void initView() {
        mFragmentManager=getSupportFragmentManager();
        mFragmentTransaction=mFragmentManager.beginTransaction();
        mFragmentTransaction.replace(R.id.my_fragment,new DemoFragment()).commit();

    }

    @Override
    public void onReload() {
        super.onReload();
        //showContent();
    }

    @Override
    protected void initData() {
        MyOkhttpUtils.getHttp(ConstantValues.URL_HEAD+ ConstantValues.Home_Banner,null);
    }


    //    @Override
//    public View getLoadingTargetView() {
//        return myContentLine;
//    }

    @Override
    public HomePresenter getPresenter() {
        return new HomePresenter(this, this);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }


    @Override
    public void showDataSuccess(List<HomeBanner> datas) {
        super.showDataSuccess(datas);
    }



}
